﻿<BadHabit_WPFTools:ShapedWindow
    x:Class="BadHabit.Factory.Windows.SprintBreak"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:BadHabit_WPFTools="clr-namespace:BadHabit.WPFTools;assembly=BadHabit.WPFTools"        
    xmlns:BadHabit_WPFTools_ValidationRules="clr-namespace:BadHabit.WPFTools.ValidationRules;assembly=BadHabit.WPFTools"
    xmlns:props="clr-namespace:BadHabit.Factory.Properties"  
    
    
    x:Name="sprintBreakWindow"
    
    Style="{StaticResource DialogEditWindow}"            
    Title="{x:Static props:Resources.Sprint_Break}"
    
    Topmost="True"
    
    Loaded="ShapedWindow_Loaded"
    
    WindowStartupLocation="CenterOwner"
    
    SizeToContent="Height" Width="400">
    
    <BadHabit_WPFTools:ShapedWindow.CommandBindings>
        <CommandBinding Command="ApplicationCommands.Undo" Executed="Undo_Executed"/>
        <CommandBinding Command="ApplicationCommands.Save" Executed="Save_Executed" CanExecute="Save_CanExecute"/>
    </BadHabit_WPFTools:ShapedWindow.CommandBindings>
    
    
    <Grid>  
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Image Grid.Column="0" Source="/Images/Toolbar/Sprint.png" Width="32" Height="32" Stretch="Uniform" VerticalAlignment="Top" Margin="5"/>
        <StackPanel Grid.Column="1" Margin="5">
            
            <RadioButton x:Name="sprintDurationRadio" GroupName="breakMode" IsChecked="True" Style="{StaticResource FormRadioButton}" VerticalContentAlignment="Top" >
                <StackPanel Orientation="Vertical" IsEnabled="{Binding ElementName=sprintDurationRadio, Path=IsChecked}">                    
                    <TextBlock Style="{StaticResource Label}" TextWrapping="Wrap" FontStyle="Italic" Text="{x:Static props:Resources.Break_sprint_by_hours_tooltip}" Margin="4,0,0,0"/>
                    <StackPanel Orientation="Horizontal" >
                        <TextBlock FontWeight="Bold" Style="{StaticResource Label}" Text="{x:Static props:Resources.Break_into_sprints_of}"/>
                        <TextBox Style="{StaticResource FormTextBox}" x:Name="sprintHoursTextBox" Width="30" TextAlignment="Right" MaxLength="3">
                            <TextBox.Text>
                                <Binding ElementName="sprintBreakWindow" Path="BreakHours" UpdateSourceTrigger="PropertyChanged">
                                    <Binding.ValidationRules>
                                        <BadHabit_WPFTools_ValidationRules:IntRangeRule Min="1" />
                                    </Binding.ValidationRules>
                                </Binding>
                            </TextBox.Text>
                        </TextBox>
                        <TextBlock FontWeight="Bold" Style="{StaticResource Label}" Text="{x:Static props:Resources.hours}"/>
                    </StackPanel>
                </StackPanel>

            </RadioButton>
            <RadioButton x:Name="sprintNumberRadio" GroupName="breakMode" Style="{StaticResource FormRadioButton}" VerticalContentAlignment="Top" Margin="0,20,0,0">
                <StackPanel Orientation="Vertical" IsEnabled="{Binding ElementName=sprintNumberRadio, Path=IsChecked}" >                    
                    <TextBlock Style="{StaticResource Label}" TextWrapping="Wrap" FontStyle="Italic" Text="{x:Static props:Resources.Break_sprint_by_number_tooltip}" Margin="4,0,0,0"/>
                    <StackPanel Orientation="Horizontal"  >
                        <TextBlock FontWeight="Bold" Style="{StaticResource Label}" Text="{x:Static props:Resources.Break_into}" />
                        <TextBox Style="{StaticResource FormTextBox}" x:Name="sprintNumberTextBox" Width="30" TextAlignment="Right"  MaxLength="2">
                            <TextBox.Text>
                                <Binding ElementName="sprintBreakWindow" Path="SprintNumber" UpdateSourceTrigger="PropertyChanged">
                                    <Binding.ValidationRules>
                                        <BadHabit_WPFTools_ValidationRules:IntRangeRule Min="1" Max="20" />
                                    </Binding.ValidationRules>
                                </Binding>
                            </TextBox.Text>
                        </TextBox>
                        <TextBlock FontWeight="Bold" Style="{StaticResource Label}">sprints.</TextBlock>
                    </StackPanel>    
                </StackPanel>
                
            </RadioButton>
            
            <CheckBox Margin="0,20,0,0" x:Name="defaultItemsCheckBox" IsChecked="True" Content="{x:Static props:Resources.Insert_sprint_default_items}"/>
            <StackPanel Orientation="Horizontal">
                <TextBlock Style="{StaticResource Label}" Text="{x:Static props:Resources.Sprint_Lenght}"/>
                <TextBox Style="{StaticResource FormTextBox}" x:Name="sprintLengthTextBox" Width="30" TextAlignment="Right"  MaxLength="2">
                    <TextBox.Text>
                        <Binding ElementName="sprintBreakWindow" Path="SprintLength" UpdateSourceTrigger="PropertyChanged">
                            <Binding.ValidationRules>
                                <BadHabit_WPFTools_ValidationRules:IntRangeRule Min="7" Max="31" />
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text>
                </TextBox>
                <TextBlock Style="{StaticResource Label}" Text="{x:Static props:Resources.days}">.</TextBlock>
            </StackPanel>
            
        </StackPanel>        
    </Grid>
</BadHabit_WPFTools:ShapedWindow>
